package com.kaikeba.util;

import com.kaikeba.bean.User;

import javax.servlet.http.HttpSession;

public class UserUtil {
    public static String getUserName(HttpSession session){
        return (String) session.getAttribute("adminUserName");
    }
    public static String getUserPhone(HttpSession session){
        User wxUser = getWxUser(session);
        // TODO : 微信快递员端录入自动获取手机,默认为188888888
        return wxUser==null?"18888888888":wxUser.getUserPhone();
    }
    public static String getLoginSms(HttpSession session,String userPhone){
        return (String) session.getAttribute(userPhone);
    }
    public static void setLoginSms(HttpSession session,String userPhone,String code){
        session.setAttribute(userPhone,code);
    }
    public static void setWxUser(HttpSession session, User user){
        session.setAttribute("wxUser",user);
    }
    public static User getWxUser(HttpSession session){
        return (User) session.getAttribute("wxUser");
    }
}
